package com.sirun.cn.fca.module.main.feature;

import android.support.v4.app.Fragment;

/**
 * 首页模块创建工厂
 *
 * @author showxiao
 * @date 2018/6/14
 */

public class MainFeatureFactory {

    public static Fragment createItem(int position) {
        try {
            return MainFeatureEnum.values()[position].fragmentClass.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        throw new IllegalStateException("undefined fragment item at position " + position);
    }

}
